IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spTdocin_Create')
	BEGIN
		PRINT 'Dropping Procedure spTdocin_Create'
		DROP  Procedure  spTdocin_Create
	END

GO

PRINT 'Creating Procedure spTdocin_Create'
GO
CREATE Procedure dbo.spTdocin_Create
	( 	  
	  @d_loc varchar(50) = null, 
		@d_user varchar(50) = null, 
		@d_status varchar(50) = null, 
		@d_datetime DateTime = null
	)
AS
  /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 9/27/2007    Initial version created
    ------------------------------------------------------------------------------
  */

	-- Declare the required variables

	-- Create the required new record
	INSERT INTO Tdocin
	  (
		d_loc,
			d_user,
			d_status,
			d_datetime	  
	  )
	VALUES
	  (
		@d_loc,
			@d_user,
			@d_status,
			@d_datetime
	  )

	-- Handle any errors
	IF @@ERROR != 0
	BEGIN
		RAISERROR('spTdocin_Create: Unable to Insert a new Tdocin', 10, 1)
		RETURN
	END

	-- Return the newly created ID
	SELECT	@@IDENTITY AS 'Tdocin_ID'

	-- Return to calling method
	RETURN 

GO
